﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;

namespace Strategy
{
    public class SendContext
    {
        SendSuper send = null;
        public static readonly string AssemblyName = "Strategy";
        public SendContext(string type)
        {
            
           send=(SendSuper)Assembly.Load(AssemblyName).CreateInstance(AssemblyName+"."+type+"Send");
            //使用反射替代条件判断
            //if (type.Equals("mail"))
            //{
            //    send = new MailSend();
            //}
            //if (type.Equals("sim"))
            //{
            //    send = new SimSend();
            //}
        }
        public void Send()
        {
            send.SendInfo();
        }
    }
}
